#ifndef CONNECT_H
#define CONNECT_H

// Libraries
#include "state.h"
#include "singleton.h"

// Classes
class ConnectState : public CState, public Singleton<ConnectState>
{
	public:
		enum StateType 
		{
			STATE_MAIN,
			STATE_CONNECT,
		};
		enum ElementType 
		{
			ELEMENT_IP,
			ELEMENT_CONNECT,
			ELEMENT_CANCEL,
		};

		bool Show();
		bool Hide();
		
		void HandleConnect(ENetEvent *TEvent);
		void HandleDisconnect(ENetEvent *TEvent);
		void HandlePacket(ENetEvent *TEvent);
		bool HandleKeyPress(EKEY_CODE TKey);
		void HandleGUI(EGUI_EVENT_TYPE TEventType, IGUIElement *TElement);

		void Update(u32 TDeltaTime);
		void Draw();

	private:
		void ChangeState(int TState);
		bool ValidateForm();

		// States
		int State;

		// GUI
		IGUITab *Form;
		IGUIStaticText *TextIP;
		IGUIEditBox *EditIP;
		IGUIButton *ButtonConnect, *ButtonCancel;
		stringc Message, IPAddress;
};

#endif
